#ifndef JOT_H
#define JOT_H

#include <gtkmm.h>
#include <gtksourceviewmm/sourcebuffer.h>
#include <boost/shared_ptr.hpp>

namespace jot {

class Document {
public:
	Document(const std::string& filename, const Glib::RefPtr<gtksourceview::SourceBuffer>& refSourceBuffer);
	std::string get_filename();
	std::string get_text();
	void set_filename(const std::string& filename);
	void write_file();
private:
	std::string m_filename;
	Glib::RefPtr<gtksourceview::SourceBuffer> m_refSourceBuffer;
};

typedef boost::shared_ptr<Document> DocumentPtr;

class Window : public Gtk::Window {
public:
	Window();
private:
	void append_page(const std::string& child_text = "", const std::string& filename = "");
	void append_empty_page();
	void read_file(const std::string& filename);
	void write_file(const std::string& filename);
	void openFileChooserDialog(const std::string& title, Gtk::FileChooserAction action, const Gtk::StockID& ok_stock_id,
			const sigc::slot<void, const std::string&>& callback);
	void on_menu_file_new();
	void on_menu_file_open();
	void on_menu_file_save();
	void on_menu_file_save_as();
	void on_menu_file_close();
	void on_menu_file_quit();
	Gtk::Notebook m_Notebook;
	std::vector<DocumentPtr> m_pDocuments;
};

std::string tab_label(const std::string& filename);

} // namespace jot

#endif // JOT_H
